
import jsTool

def main(path):
    cSet = jsTool.j2o('collectSet.json')
    kind = ['music','book','movie']
    fname2link={}
    for k in kind :
        kSet = cSet[k]
        for link in kSet.keys():
            fname = path+'\\'+k+link.split('/')[-2]+'['+kSet[link]['title']+'].jpg'
            #fname = 'smallpics/'+k+'/'+link.split('/')[-1]+'cxc'+kSet[link]['title']+'cxc'+kSet[link]['pic'].replace('/','-')
            url  = kSet[link]['pic']
            #imgDownload(url,fname)
            fname2link[fname]=kSet[link]['pic']
            print kSet[link]['pic'],
            print fname
            #print fname2link
    jsTool.o2j(fname2link,'fname2link.json')
    
if __name__=='__main__':
    main('home')
